using System;
using System.Runtime.CompilerServices;

namespace Microsoft.SqlServer.Management.SqlManagerUI.Scripting
{
	internal abstract class ScriptTarget
	{
        public event EventHandler<ScriptingProgressEventArgs> WritingObject;
        //{
        //    [MethodImpl(MethodImplOptions.Synchronized)]
        //    add
        //    {
        //        this.WritingObject = (EventHandler<ScriptingProgressEventArgs>)Delegate.Combine(this.WritingObject, value);
        //    }
        //    [MethodImpl(MethodImplOptions.Synchronized)]
        //    remove
        //    {
        //        this.WritingObject = (EventHandler<ScriptingProgressEventArgs>)Delegate.Remove(this.WritingObject, value);
        //    }
        //}

		public abstract EventHandler<ObjectScriptedEventArgs> ObjectScriptedHandler
		{
			get;
		}

		public abstract EventHandler ScriptingFinishedHandler
		{
			get;
		}

		public void OnWritingObject(object sender, ScriptingProgressEventArgs e)
		{
			if (this.WritingObject != null)
			{
				this.WritingObject(this, e);
			}
		}
	}
}
